package com.hrserviceserve.dao;

import com.hrserviceserve.entity.Salary;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;


public interface SalaryRepository extends JpaRepository<Salary,Integer> {
//    @Query(value = "select * from salary where " +
//            "if(?1!='',personnel_id=?1,1=1)",nativeQuery = true)
//    Page<Salary> findAllWhere(Integer personnelId, Pageable pageable);

    @Query(value = "select * from salary where " +
            "if(?1!='',personnel_id=?1,1=1)",nativeQuery = true)
    Page<Salary> findAllWhere(Integer personnelId, Pageable pageable);



    int deleteByPersonnelId(int id);
}
